<!-- Modal -->
<div
  class="modal fade modal-default"
  id="dlg-preview-popup"
  tabindex="-1"
  role="dialog"
  aria-hidden="true"
>
  <div
    class="modal-dialog {{$ctrl.previewObject.size}} modal-dialog-centered"
    role="document"
  >
    <div class="modal-content">
      <div class="modal-header py-2">
        <h6 class="modal-title" ng-if="$ctrl.previewObject.data.detailsUrl">
          <i class="mi mi-PreviewLink"></i>
          <span ng-bind="$ctrl.previewObject.title"></span> -
          <a
            class="text-primary"
            ng-if="$ctrl.previewObject.data.detailsUrl"
            href="{{$ctrl.previewObject.data.detailsUrl ||$ctrl.previewObject.data}}"
            target="_blank"
            ><i class="mi mi-NewWindow"></i> New Window</a
          >
          <a
            class="text-primary btn"
            ng-if="$ctrl.previewObject.data.editUrl"
            ng-click="$ctrl.goToLink($ctrl.previewObject.data.editUrl)"
            ><i class="mi mi-Pencil"></i>- Edit</a
          >
        </h6>
        <h6 class="modal-title" ng-if="!$ctrl.previewObject.data.detailsUrl">
          Preview
        </h6>
        <button
          type="button"
          class="btn-close"
          data-bs-dismiss="modal"
          aria-label="Close"
          style="z-index: 999"
        >
          <!--  -->
        </button>
      </div>
      <div class="modal-body">
        <div class="container">
          <div ng-switch="$ctrl.previewObject.type">
            <div class="row" ng-switch-when="img">
              <div class="col-md-12 p-0">
                <a class="" href="{{$ctrl.previewObject.data}}" target="_blank">
                  <img
                    class="img mr-auto ml-auto"
                    style="display: block"
                    ng-src="{{$ctrl.previewObject.data}}"
                  />
                </a>
              </div>
            </div>
            <div ng-switch-when="mix-database-data">
              <div
                ng-repeat="column in $ctrl.previewObject.data.columns | orderBy: 'priority' track by $index"
                class="py-2 row"
              >
                <div class="col-md-3">
                  <p><b ng-bind="column.title"></b>:</p>
                </div>
                <div class="col-md-9">
                  <mix-column-preview
                    model="$ctrl.previewObject.data.item.obj[column.name]"
                    column="column"
                  >
                  </mix-column-preview>
                </div>
              </div>
            </div>
            <div ng-switch-when="module-data" class="">
              <module-preview
                module-id="$ctrl.previewObject.data.moduleId"
                content-id="$ctrl.previewObject.data.id"
              >
              </module-preview>
            </div>
            <div ng-switch-when="post" class="">
              <div class="row">
                <div class="col-md-12">
                  <h1 ng-bind="$ctrl.previewObject.data.title"></h1>
                  <img
                    class="img mr-auto ml-auto"
                    style="display: block"
                    ng-src="{{$ctrl.previewObject.data.imageUrl}}"
                  />
                  <p></p>
                </div>
              </div>
              <div class="row">
                <div
                  class="col-md-12"
                  ng-bind-html="$ctrl.previewObject.data.content"
                ></div>
              </div>
            </div>
            <div ng-switch-when="message">
              <div class="row col-md-12">
                <span
                  ng-bind="$ctrl.previewObject.data"
                  class="text-{{$ctrl.previewObject.objClass}}"
                >
                </span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
